package com.wwp.tbshop.accout_center.presenter;

import android.content.Context;
import android.util.Log;

import com.wwp.tbshop.model.bean.BaseBean;
import com.wwp.tbshop.model.bean.UserInfoBean;
import com.wwp.tbshop.presenter.BasePresenter;
import com.wwp.tbshop.view.fragment.UserFragment;

import retrofit2.Call;

/**
 * Created by Administrator on 6/16/2017.
 */

public class GetUeserId_presenter extends BasePresenter{

    private static final String TAG = "userinfo";
    public Context mContext;
    public UserFragment mUserFragment;


    public GetUeserId_presenter(UserFragment userFragment) {
        mUserFragment = userFragment;
    }



    public void loadUserNewsInfo(String s){
        Call<UserInfoBean> userInfoBeanCall = mApiService.login_userinfo(s);
        userInfoBeanCall.enqueue(mCallback);
    }

    @Override
    protected void onServerBug(int code) {

    }

    @Override
    protected void onConnectError(String message) {

    }

    @Override
    protected void onSuccess(BaseBean baseBean) {

        // 成功回调useractivity的方法
        //解析
        //数据 --》 activity

        UserInfoBean userInfoBean = (UserInfoBean) baseBean;
        Log.e(TAG, "数据为："+userInfoBean.getError()+";"+userInfoBean.getError_code());

        if (userInfoBean!=null) {
            mUserFragment.successForBack(userInfoBean);
        }else {
            Log.e(TAG, "数据请求成功："+userInfoBean.getError()+";"+userInfoBean.getError_code());
        }



    }
}
